package com.example.serviceheadlines.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.serviceheadlines.mapper.HeadlinesImagesMapper;
import com.example.serviceheadlines.service.HeadlinesImagesService;
import com.tangyuan.model.HeadlinesImages;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Service
public class HeadlinesImagesServiceImpl extends ServiceImpl<HeadlinesImagesMapper, HeadlinesImages> implements HeadlinesImagesService {

    @Autowired
    private HeadlinesImagesMapper headlinesImagesMapper;
    @Override
    public Integer insertImages(List<String> urlList, Long itemId) {
        if(CollectionUtils.isEmpty(urlList) || itemId == null){
            return 0;
        }
        return baseMapper.insertImages(urlList,itemId);
    }

    @Override
    public List<String> selectImageList(Long itemId) {
        return baseMapper.selectImageList(itemId);
    }

    @Override
    public List<HeadlinesImages> getHeadlinesImagesByItemId(List<Long> itemIds) {
        return headlinesImagesMapper.getHeadlinesImagesByItemId(itemIds);
    }
}
